package com.cuijq.ms.statedesign.v5;

import com.cuijq.ms.statedesign.v5.impl.SmallMario;

/**
 * @author by CuiJQ
 * @Classname MarioStateMachine
 * @Description MarioStateMachine Description
 * @Date 2021/5/29 15:18
 * <p>
 */
public class MarioStateMachine {


  private int score;
  private IMario currentState;

  public MarioStateMachine() {
    this.score = 0;
    this.currentState = SmallMario.getInstance();
  }

  public void obtainMushRoom() {
    this.currentState.obtainMushRoom(this);
  }

  public void obtainCape() {
    this.currentState.obtainCape(this);
  }

  public void obtainFireFlower() {
    this.currentState.obtainFireFlower(this);
  }

  public void meetMonster() {
    this.currentState.meetMonster(this);
  }

  public int getScore() {
    return this.score;
  }

  public State getCurrentState() {
    return this.currentState.getName();
  }

  public void setScore(int score) {
    this.score = score;
  }

  public void setCurrentState(IMario currentState) {
    this.currentState = currentState;
  }

}
